package com.my.study.service.Impl;

import com.my.study.convert.RoleConvert;
import com.my.study.entity.Role;
import com.my.study.mapper.RoleMapper;
import com.my.study.service.RoleUserService;
import com.my.study.vo.UserRoleVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoleUserServiceImpl implements RoleUserService {

    @Autowired
    private RoleMapper roleMapper;
    @Autowired
    private RoleConvert roleConvert;

    @Override
    public UserRoleVO queryRole(String roleId) {
        Role role = roleMapper.queryRole(roleId);
        return roleConvert.toTarget(role);
    }

    @Override
    public void removeRoleById(String roleId) {
        roleMapper.deleteByPrimaryKey(roleId);
    }
}
